package com.online.service.user.Impl;

import com.online.dao.user.Impl.UserDaoImpl;
import com.online.dao.user.UserDao;
import com.online.pojo.User;
import com.online.pojo.menu;
import com.online.service.user.UserService;

import java.sql.SQLException;
import java.util.List;

public class UserServiceImpl implements UserService {

    public User login( String  name) {
        UserDao userDao=new UserDaoImpl();
        User user = new User();
        return  userDao.getLoginUser(user,  name );
    }

    public boolean submit(String number, String name, String pwd) {
        UserDao userDao=new UserDaoImpl();
        return userDao.insertUser(number,name,pwd);
    }

    public boolean editPermission(String name) throws SQLException {
        UserDao userDao=new UserDaoImpl();
        return userDao.update(name);
    }

    public List<menu> showAllmenu(List<menu> list) throws SQLException {
        UserDao userDao=new UserDaoImpl();
        return userDao.select(list);
    }

    public boolean addM(String name, double account) throws SQLException {
        UserDao userDao=new UserDaoImpl();
        return userDao.updateAccount(name,account);
    }

    public boolean cutM(String name, double price) throws SQLException {
        UserDao userDao=new UserDaoImpl();
        return userDao.updateaccount(name,price);
    }
}
